package com.tuyan.aixiang.activity.home.map;

import android.os.Bundle;

import androidx.fragment.app.Fragment;
import butterknife.BindView;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.tencent.smtt.sdk.WebView;
import com.tuyan.aixiang.R;
import com.tuyan.aixiang.activity.web.JsBridge;
import com.tuyan.aixiang.common.BaseActivity;
import com.tuyan.aixiang.common.BaseFragment;
import com.tuyan.aixiang.common.BasePresenter;
import com.tuyan.aixiang.common.Constant;
import com.tuyan.aixiang.util.WebUtil;

public class MapFragment extends BaseFragment {

    @BindView(R.id.wv_main)
    WebView wvMain;

    @Override
    protected void initView(View contentView) {
        WebUtil.configWebview((BaseActivity) getActivity(), wvMain, true);
        ((BaseActivity) getActivity()).showLoading();
        wvMain.loadUrl(Constant.MAP_INDEX);
        Log.e("url", ""+wvMain.getUrl() );
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_map;
    }

    @Override
    protected BasePresenter createPresenter() {
        return null;
    }

    @Override
    public void onDestroy() {
        try {
            wvMain.stopLoading();
            wvMain.setTag(null);
            wvMain.removeAllViews();
            wvMain.clearHistory();
            wvMain.clearCache(true);
            wvMain.setWebViewClient(null);
            wvMain.setWebChromeClient(null);
            wvMain.destroy();
        } catch (Exception ignore){}
        super.onDestroy();
    }
}